package com.itheima.stock.config;

import com.itheima.stock.properties.IdWorkerProperties;
import com.itheima.stock.util.IdWorkers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zby
 * @created 2024-06-24 19:03
 * @description ID生成器配置类
 */
@Configuration
public class IdWorkerConfiguration {

    @Bean
    public IdWorkers idWorkers(IdWorkerProperties properties) {
        return new IdWorkers(properties.getMachineId(), properties.getDataCenterId());
    }

}
